package framework.module.webservice.server.service.impl;

import com.alibaba.fastjson.JSON;
import framework.common.ResponseVo;
import framework.module.webservice.server.service.IUserService;
import framework.module.webservice.server.vo.User;

import java.util.Arrays;
import java.util.List;

/**
 * @author 吴宇亮 on 2019/8/7 0007 下午 4:17
 */
public class UserServiceImpl implements IUserService {

    @Override
    public List<User> findAllUser() {
        User user = new User();
        user.setId(1);
        user.setUsername("张三");
        user.setCity("广州");

        User user2 = new User();
        user2.setId(2);
        user2.setUsername("李四");
        user2.setCity("北京");
        return Arrays.asList(user, user2);
    }

    @Override
    public User getUser(Integer id) {
        User user = new User();
        user.setId(1);
        user.setUsername("getUser张三");
        user.setCity("广州");
        return user;
    }

    @Override
    public void saveUser(User user) {
        System.out.println("saveUser:" + user);
    }

    @Override
    public String hello(String str) {
        ResponseVo vo = new ResponseVo();
        vo.setCode(ResponseVo.SUSCCESS);
        vo.setData("嗯？小牛皮系统不懂你发的'" + str + "'是什么意思！");
        return JSON.toJSONString(vo);
    }

}
